% select a subset of colors that productes the others
% in a greedy way

function selected = greedyColors(colors)

thresh = 0.05;

selected = [0,0,0];

tcolors = colors;

figure(33);
scatter3(colors(:,1), colors(:,2), colors(:,3), 30, colors, 'filled');
hold on;

while(~isempty(tcolors))
    [c, I] = selectMinimalColor(tcolors)
    
    inds = 1:size(tcolors,1);
    tcolors = tcolors(inds~=I,:);
    
    if(~isCombinationOfColors(c, selected))
        scatter3(c(1), c(2), c(3), 120, c, 'filled');
        scatter3(c(1), c(2), c(3), 30, 1 - c, 'filled');
    
        selected = [selected; c];
        disp('adding');
    else
        scatter3(c(1), c(2), c(3), 30, [0, 0, 0], 'filled');
        disp('not adding');
    end
    
    pause(0.05);
    
end


